// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CollapsiblePanelActionList.cs" company="">
//   
// </copyright>
// <summary>
//   The collapsible panel action list.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace OVT.CustomControls
{
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Drawing;

    /// <summary>
    /// The collapsible panel action list.
    /// </summary>
    public class CollapsiblePanelActionList : DesignerActionList
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CollapsiblePanelActionList"/> class.
        /// </summary>
        /// <param name="component">
        /// The component.
        /// </param>
        public CollapsiblePanelActionList(IComponent component)
            : base(component)
        {
        }

        /// <summary>
        /// Gets or sets Title.
        /// </summary>
        public string Title
        {
            get
            {
                return ((CollapsiblePanel)this.Component).HeaderText;
            }

            set
            {
                PropertyDescriptor property = TypeDescriptor.GetProperties(this.Component)["HeaderText"];
                property.SetValue(this.Component, value);
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether UseAnimation.
        /// </summary>
        public bool UseAnimation
        {
            get
            {
                return ((CollapsiblePanel)this.Component).UseAnimation;
            }

            set
            {
                PropertyDescriptor property = TypeDescriptor.GetProperties(this.Component)["UseAnimation"];
                property.SetValue(this.Component, value);
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether Collapsed.
        /// </summary>
        public bool Collapsed
        {
            get
            {
                return ((CollapsiblePanel)this.Component).Collapse;
            }

            set
            {
                PropertyDescriptor property = TypeDescriptor.GetProperties(this.Component)["Collapse"];
                property.SetValue(this.Component, value);
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether ShowSeparator.
        /// </summary>
        public bool ShowSeparator
        {
            get
            {
                return ((CollapsiblePanel)this.Component).ShowHeaderSeparator;
            }

            set
            {
                PropertyDescriptor property = TypeDescriptor.GetProperties(this.Component)["ShowHeaderSeparator"];
                property.SetValue(this.Component, value);
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether UseRoundedCorner.
        /// </summary>
        public bool UseRoundedCorner
        {
            get
            {
                return ((CollapsiblePanel)this.Component).RoundedCorners;
            }

            set
            {
                PropertyDescriptor property = TypeDescriptor.GetProperties(this.Component)["RoundedCorners"];
                property.SetValue(this.Component, value);
            }
        }

        /// <summary>
        /// Gets or sets HeaderCornersRadius.
        /// </summary>
        public int HeaderCornersRadius
        {
            get
            {
                return ((CollapsiblePanel)this.Component).HeaderCornersRadius;
            }

            set
            {
                PropertyDescriptor property = TypeDescriptor.GetProperties(this.Component)["HeaderCornersRadius"];
                property.SetValue(this.Component, value);
            }
        }

        /// <summary>
        /// Gets or sets HeaderImage.
        /// </summary>
        public Image HeaderImage
        {
            get
            {
                return ((CollapsiblePanel)this.Component).HeaderImage;
            }

            set
            {
                PropertyDescriptor property = TypeDescriptor.GetProperties(this.Component)["HeaderImage"];
                property.SetValue(this.Component, value);
            }
        }

        /// <summary>
        /// The get sorted action items.
        /// </summary>
        /// <returns>
        /// </returns>
        public override DesignerActionItemCollection GetSortedActionItems()
        {
            var items = new DesignerActionItemCollection();

            items.Add(new DesignerActionHeaderItem("Header Parameters"));
            items.Add(new DesignerActionPropertyItem("Title", "Panel's header text"));
            items.Add(new DesignerActionPropertyItem("HeaderImage", "Image"));
            items.Add(new DesignerActionPropertyItem("UseAnimation", "Animated panel"));
            items.Add(new DesignerActionPropertyItem("Collapsed", "Collapse"));
            items.Add(new DesignerActionPropertyItem("ShowSeparator", "Show borders"));
            items.Add(new DesignerActionPropertyItem("UseRoundedCorner", "Rounded corners"));
            items.Add(new DesignerActionPropertyItem("HeaderCornersRadius", "Corner's radius [5,10]"));

            return items;
        }
    }
}